{literal}
<script language="JavaScript" type="text/JavaScript">
function showCategory(uid)
{   

	if (document.getElementById('type_'+uid).value == 2)
	{  
	  
		document.getElementById("cats").style.display ='block';
		

	} else 
	{
		document.getElementById("cats").style.display ='none';
		
	}	
}
function seleccionar(choiceBox,selBox,str_sel) {
  	choiceBox		= document.getElementById(choiceBox);
  	choiceBoxLength	= choiceBox.length;
  	selBox			= document.getElementById(selBox);
  	str_sel			= document.getElementById(str_sel);
    for ( i=0; i<choiceBoxLength; i++){
        if (choiceBox.options[i].selected == true ) {
            selBoxLength= selBox.length;
				var text 	= choiceBox.options[i].text;
				var value 	= choiceBox.options[i].value;
            selBox.options[selBoxLength]= new Option(text,value);
        }
    }

    for ( i = (choiceBoxLength -1); i>=0; i--){
        if (choiceBox.options[i].selected == true ) {
            choiceBox.options[i] = null;
        }
    }	
	grabar(choiceBox,selBox,str_sel);
  }

  function quitar(choiceBox,selBox,str_sel) {
  	choiceBox	= document.getElementById(choiceBox);
  	selBox		= document.getElementById(selBox);
  	str_sel		= document.getElementById(str_sel);
  	
    selBoxLength = selBox.length ;
	for ( i=0; i<selBoxLength; i++){
      if (selBox.options[i].selected == true ) {
        choiceBoxLength = choiceBox.length;
		var text 	= selBox.options[i].text;
		var value 	= selBox.options[i].value;
        choiceBox.options[choiceBoxLength]= new Option(text,value);
       }
    }
    for ( i=(selBoxLength-1); i>=0; i--) {
      if (selBox.options[i].selected == true ) {
        selBox.options[i] = null;
      }
    }	
	grabar(choiceBox,selBox,str_sel);		  
  }

 function grabar(choiceBox,selBox,str_sel) {
	var strValues = "";
	var boxLength = selBox.length;

	for (i = 0; i < boxLength; i++) {
		itemVal = selBox.options[i].value;
		if (strValues == "")
			strValues = itemVal;
		else
			strValues = strValues + "/" + itemVal;
	}
	str_sel.value = strValues;	
	choiceBox.selectedIndex=-1;
	selBox.selectedIndex=-1;	
  }
  
  function restaurar(choiceBox,selBox,str_sel) {
  	choiceBox		= document.getElementById(choiceBox);
  	selBox			= document.getElementById(selBox);
  	str_sel			= document.getElementById(str_sel);
	sel_arr	 		= str_sel.value.split("/");
	for (x = 0; x < sel_arr.length; x++ ) { 
		for (y = 0; y < choiceBox.length; y++ ) {
	 	  text	= choiceBox.options[y].text;
	 	  value	= choiceBox.options[y].value;
		  if ( value == sel_arr[x]) {
		    selBox.options[selBox.length] = new Option(text,value);
	 		 choiceBox.options[y] = null;
		  }	 
		}
	}
	grabar(choiceBox,selBox,str_sel);		  
  }  
</script>
{/literal}
<table  align="center" width="953" style="BORDER-RIGHT:#999 1px solid; border-bottom:#999 1px solid; border-left:#999 1px solid; 
        border-top:#999 1px solid;" border="0" cellpadding="0" cellspacing="0">
		
  <!--DWLayoutTable-->
  <tr>
    <td height="40" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="20" height="19" valign="top" bgcolor="#333333" style="border-bottom:#999999 2px solid;"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="644" valign="middle" bgcolor="#333333" class="style2" style="border-bottom:#999999 2px solid;">Administracion
          de Usuarios - Tipo: {if $data.users[0].type == 1}Administrador{elseif $data.users[0].type == 2}Administrador de Categorias{else}Administrador de Estadisticas{/if} </td>
        <td width="268" align="right" valign="middle" bgcolor="#333333" class="style2" style="border-bottom:#999999 2px solid;">[<a href="{$conf.html}/admin.php" class="blanco">Administradores</a>]</td>
        <td bgcolor="#333333" style="border-bottom:#999999 2px solid;" width="19" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td  width="15" height="312" valign="top"  ><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td width="936" valign="top">
	  <table    width="100%" border="0" cellpadding="0" cellspacing="0">
	    <!--DWLayoutTable-->
	    <form method="post" action="{$conf.html}/admin.php" >
	      <input type="hidden" name="cid" value="{$category.cid}">
	      <tr>
	        <td width="314" height="20">&nbsp;</td>
            <td width="57">&nbsp;</td>
            <td width="26">&nbsp;</td>
            <td width="539">&nbsp;</td>
          </tr>
	      {section name="u" loop=$data.users}
	      <tr>
	        <td height="188" valign="top"><table  width="100%" border="0" cellpadding="0" cellspacing="0">
	          <!--DWLayoutTable-->
	          <tr>
	            <td width="114" height="25"   >Nombre:</td>
                  <td width="191"   >
                 <input type="text" name="name[{$data.users[u].uid}]" size="15" value="{$data.users[u].name}" maxlength="50">             </td>
                  <td width="9" >&nbsp;</td>
                </tr>
	          
	          <tr>
	            <td height="25"   >Correo:</td>
                  <td>
                    <input type="text" name="email[{$data.users[u].uid}]" size="23" value="{$data.users[u].email}" maxlength="70">               </td>
                  <td >&nbsp;</td>
                </tr>
	          <tr>
	            <td height="25"    >Nombre
	              de Usuario: </td>
                  <td   >
                    <input type="text" name="username[{$data.users[u].uid}]" size="23" value="{$data.users[u].username}" maxlength="70">               </td>
                  <td >&nbsp;</td>
                </tr>
	          <tr>
	            <td height="25"  >Clave:</td>
                  <td>
                  <input type="password" name="password[{$data.users[u].uid}]" size="23" value="{$data.users[u].password}" maxlength="100">				  </td>
  			      <input type="hidden" name="actual_password[{$data.users[u].uid}]" value="{$data.users[u].password}" maxlength="50">
	            <td >&nbsp;</td>
                </tr>
	          <tr>
	            <td height="25"   >Lugar:</td>
                  <td   >
                    <input type="text" name="place[{$data.users[u].uid}]" size="27" value="{$data.users[u].place}" maxlength="70">               </td>
                  <td >&nbsp;</td>
                </tr>
	          <tr>
	            <td height="25"  >Estado (activo):</td>
                  <td  >
				  <input type="checkbox" name="active[{$data.users[u].uid}]" value="1"   {$data.users[u].active_selected}>				  </td>
                  <td>&nbsp;</td>
                </tr>
				
	          <tr>
	            <td height="25"  >Tipo:</td>
                  <td  ><select name="type_{$data.users[u].uid}" id="type_{$data.users[u].uid}" onChange="showCategory('{$data.users[u].uid}');">
          {section name=s loop=$data.admin_type.uid}
            <option value="{$data.admin_type.uid[s]}" {if $data.users[u].type eq $data.admin_type.uid[s]}selected{/if}>{$data.admin_type.name[s]}</option>
          {/section}
        </select>                  </td>
                  <td>&nbsp;</td>
                </tr>
	          
	          
            </table></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
	      
	      <tr>
	        <td height="18"></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
	      <tr>
	        <td height="0"   colspan="3" valign="top">
              <div id="cats" style="display: none;">
                <table class="centro" width="100%" border="0" cellpadding="0" cellspacing="0">
                  <!--DWLayoutTable-->
                  <tr>
                    <td height="24" colspan="2"  ><strong>Categorias</strong></td>
                    <td width="53" >&nbsp;</td>
                    <td width="166" >&nbsp;</td>
                  </tr>
                  <tr>
                    <td width="170" height="76" >
                    <select name="cid_{$data.users[u].uid}[]" id="cid_{$data.users[u].uid}" size="4" multiple  style="width: 150px;">
			{if $data.users[u].type neq "2"}
				{section name=ac loop=$category.category}
				{assign var='cat' value=$category.cid[ac]}
				<option value="{$category.cid[ac]}">{$category.category.$cat}</option>
				{/section}
			{else}
				{section name=tac loop=$data.users[u].category_no_selected.key}
				<option value="{$data.users[u].category_no_selected.key[tac]}">{$data.users[u].category_no_selected.value[tac]}</option>
				{/section}
			{/if}
			</select>            </td>
                    <td colspan="2"   >
                      <input class="button" name="b_anhadir" type="button" id="b_anhadir" onClick="seleccionar('cid_{$data.users[u].uid}','adm_cid_{$data.users[u].uid}','tipos_{$data.users[u].uid}')" value="&gt;&gt;">
                      <br />
                      <br />
                    <input class="button" name="b_quitar" type="button" id="b_quitar" onClick="quitar('cid_{$data.users[u].uid}','adm_cid_{$data.users[u].uid}','tipos_{$data.users[u].uid}')" value="&lt;&lt;">            </td>
                    <td  >
                    <select name="adm_cid_{$data.users[u].uid}[]" id="adm_cid_{$data.users[u].uid}" size="4" multiple style="width: 150px;">
				{if $data.users[u].type neq "2"}
				{else}
					{section name="act" loop=$data.users[u].category_selected.cid}
					{assign var='cid' value=$data.users[u].category_selected.cid[act]}
					<option value="{$data.users[u].category_selected.cid[act]}">{$data.users[u].category_selected.category.$cid}</option>
					{/section}
				{/if}
			 </select></td>
                  </tr>
                  <tr>
                    <td height="5"></td>
                    <td width="11"></td>
                    <td></td>
                    <td></td>
                  </tr>
                </table>
	        </div></td>
            <td></td>
          </tr>
	      <tr>
	        <td height="22">&nbsp;</td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
	      <tr>
	        <td height="32" colspan="2" valign="top"><table  border="0" cellpadding="0" cellspacing="0">
	          <!--DWLayoutTable-->
	          <tr>
	            {if $data.users[u].uid neq 'x0'}<td width="101"  height="26" valign="top"><input type="submit" name="actualizar_admin_users" value="Actualizar"></td>{/if}
	            {if $data.users[u].uid eq 'x0'}<td width="137"  valign="top"><input type="submit" name="insertar_admin_users"  value="Insertar Nuevo" /></td> {/if}
	            
	            {*if $data.users[u].uid neq 'x0'}<td width="97"  valign="top"><input type="submit" name="Submit32" value="Eliminar" /></td> {/if*}
                  <td width="36">&nbsp;</td>
                  
                  <!--td  valign="top"><input type="reset"  name="Submit322" value="Resetear" /></td-->
	            </tr>
	          <tr>
	            <td height="6"></td>
                  <td></td>
                  <td></td>
                  <td></td>
	          </tr>
	          
	          
            </table></td>
            <td>&nbsp;</td>
	        <td></td>
          </tr>
	      <tr>
	        <td height="32">&nbsp;</td>
	        <td></td>
	        <td></td>
	        <td></td>
          </tr>
	      
	      
		  <script>
		    showCategory('{$data.users[u].uid}');
			 //alert({$data.users[u].type});
		  </script>
	      <input name="tipos_{$data.users[u].uid}" id="tipos_{$data.users[u].uid}" type="hidden" value="{$data.users[u].tipos}"> 
	      {/section}
     </form>
      </table></td>
  </tr>
  
  <tr>
    <td height="26" colspan="2" valign="top"  ><table style="border-top:#999 1px solid;"  width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      
      <tr>
        <td width="951" height="26" align="center" valign="middle" bgcolor="#EBEBEB" style="border-top:#D7D7D7 2px solid; border-bottom:#D7D7D7 2px solid;"><strong>[<a href="{$conf.html}/admin.php" class="negro">Administradores</a> | <a href="{$conf.html}/index.php" class="negro">Pagina Principal</a>]</strong></td>
        </tr>
      
      
    </table></td>
  </tr>
</table>
